//=======================================================================================
// d3dApp.h by Frank Luna (C) 2008 All Rights Reserved.
//
// Simple Direct3D demo application class.  
// Make sure you link: D3D11.lib D3DX11d.lib dxerr.lib dxguid.lib.
// Link D3DX11.lib for release mode builds instead of D3DX11d.lib.
//=======================================================================================


#ifndef D3DAPP_H
#define D3DAPP_H

#pragma comment(lib,"d3d11.lib")
#pragma comment(lib,"d3dx11.lib")
#pragma comment(lib,"dxerr.lib")

#include "d3dUtil.h"
#include "GameTimer.h"
#include <string>
#include <map>


class D3DApp
{
public:
	D3DApp(HINSTANCE hInstance, std::string name);
	virtual ~D3DApp();

	HINSTANCE getAppInst();
	HWND      getMainWnd();

	int run();

	// Framework methods.  Derived client class overrides these methods to 
	// implement specific application requirements.

	virtual void initApp();
	virtual void onResize();// reset projection/etc
	virtual void updateScene(float dt);
	virtual void drawScene();
	virtual void CleanApp();
	virtual LRESULT msgProc(UINT msg, WPARAM wParam, LPARAM lParam);

protected:
	void initMainWindow();
	void initDirect3D();

protected:

	HINSTANCE mhAppInst;
	HWND      mhMainWnd;
	bool      mAppPaused;
	bool      mMinimized;
	bool      mMaximized;
	bool      mResizing;

	GameTimer mTimer;
	 
	std::string mFrameStats;
	float minSec, maxSec;

	ID3D11Device* md3dDevice;
	ID3D11DeviceContext* m_deviceContext;
	IDXGISwapChain*  mSwapChain;
	ID3D11Texture2D* mDepthStencilBuffer;
	ID3D11RenderTargetView* mRenderTargetView;
	ID3D11DepthStencilView* mDepthStencilView;
	//ID3DX11Font* mFont;

	// Derived class should set these in derived constructor to customize starting values.
	std::string mMainWndCaption;
	//D3D11_DRIVER_TYPE md3dDriverType;
	XMFLOAT4 mClearColor;
	int mClientWidth;
	int mClientHeight;

	static double frameCount;
	static double totalFramesPerSecond;
	static double totalMillisecondsPerFrame;
	static std::map<float, int> D3DApp::modeFPS;
	static std::map<float, int> D3DApp::modeMPF;
};




#endif // D3DAPP_H